package com.netcracker.training.automonic.dao.roles;

import java.sql.Date;
import java.util.List;

import com.netcracker.training.automonic.dao.entities.Attribute;
import com.netcracker.training.automonic.dao.entities.AttributeType;
import com.netcracker.training.automonic.dao.entities.Object;
import com.netcracker.training.automonic.dao.entities.Site;
import com.netcracker.training.automonic.dao.entities.Statistics;
import com.netcracker.training.automonic.dao.entities.StatsType;

/**
 * DAO role.
 * 
 * <p>Rights: READ ONLY.
 * 
 * <p>Recommend to use for data visualization without risk of harm data. 
 * 
 * @author Vadim Gidulyan
 * 
 * @see ReadWriteDAO
 * @see WriteDAO
 */

public interface ReadDAO
{

	// Site
	
	/**
	 * Returns site with specified id.
	 * 
	 * @param id site id
	 * 
	 * @return site with specified id
	 */
	Site selectSiteById(int id);
	
	/**
	 * Returns site with specified name.
	 * 
	 * @param name site name
	 * 
	 * @return site with specified name
	 */
	Site selectSiteByName(String name);
	
	// Object
	
	/**
	 * Returns object with specified id.
	 * 
	 * @param id object id
	 * 
	 * @return object with specified id
	 */
	Object selectObjectById(int id);
	
	/**
	 * Returns object with specified site and name.
	 * 
	 * @param site object's site
	 * @param name object name
	 * 
	 * @return object with specified site and name
	 */
	Object selectObjectBySiteAndName(Site site, String name);
	
	/**
	 * Returns list of objects of specified site.
	 * 
	 * @param site object's site
	 * 
	 * @return list of objects of specified site
	 */
	List<Object> selectObjectsBySite(Site site);
	
	/**
	 * Returns list of objects with specified name.
	 * 
	 * @param name object name
	 * 
	 * @return list of objects with specified name
	 */
	List<Object> selectObjectsByName(String name);
	
	// AttributeType
	
	/**
	 * Returns attribute type with specified id.
	 * 
	 * @param id attribute type id
	 * 
	 * @return attribute type with specified id
	 */
	AttributeType selectAttributeTypeById(int id);
	
	/**
	 * Returns attribute type with specified code.
	 * 
	 * @param code attribute type code
	 * 
	 * @return attribute type with specified code
	 */
	AttributeType selectAttributeTypeByCode(String code);
	
	/**
	 * Returns list of attribute types with specified name.
	 * 
	 * @param name attribute type name
	 * 
	 * @return list of attribute types with specified name
	 */
	List<AttributeType> selectAttributeTypesByName(String name);
	
	// Attributes
	
	/**
	 * Returns attribute with specified id.
	 * 
	 * @param id attribute id
	 * 
	 * @return attribute with specified id
	 */
	Attribute selectAttributeById(int id);
	
	/**
	 * Returns attribute with specified object and attribute type.
	 * 
	 * @param object object
	 * @param attributeType attribute type
	 * 
	 * @return attribute with specified object and attribute type
	 */
	Attribute selectAttributesByObjectAndType(Object object, 
	                                          AttributeType attributeType);
	
	/**
	 * Returns list of attributes of specified object.
	 * 
	 * @param object object
	 * 
	 * @return list of attributes of specified object
	 */
	List<Attribute> selectAttributesByObject(Object object);
	
	/**
	 * Returns list of attributes of specified attribute type.
	 * 
	 * @param attributeType attribute type
	 * 
	 * @return list of attributes of specified attribute type
	 */
	List<Attribute> selectAttributesByType(AttributeType attributeType);
	
	// StatsType
	
	/**
	 * Returns statistics type with specified id.
	 * 
	 * @param id statistics type id
	 * 
	 * @return statistics type with specified id
	 */
	StatsType selectStatsTypeById(int id);
	
	/**
	 * Returns statistics type with specified code.
	 * 
	 * @param code statistics type code
	 * 
	 * @return statistics type with specified code
	 */
	StatsType selectStatsTypeByCode(String code);
	
	/**
	 * Returns list of statistics types with specified name.
	 * 
	 * @param name statistics type name
	 * 
	 * @return list of statistics types with specified name
	 */
	List<StatsType> selectStatsTypesByName(String name);
	
	// Statistics
	
	/**
	 * Returns statistics with specified time and statistics type for specified 
	 * object.
	 * 
	 * @param time statistics time
	 * @param object object
	 * @param statsType statistics type
	 * 
	 * @return statistics with specified time and statistics type for specified 
	 * object
	 */
	Statistics selectStatistics(Date time, Object object, StatsType statsType);
	
	/**
	 * Returns list of statistics with specified time.
	 * 
	 * @param time statistics time
	 * 
	 * @return list of statistics with specified time
	 */
	List<Statistics> selectStatisticsByTime(Date time);
	
	/**
	 * Returns list of statistics of specified object.
	 * 
	 * @param object object
	 * 
	 * @return list of statistics of specified object
	 */
	List<Statistics> selectStatisticsByObject(Object object);
	
	/**
	 * Returns list of statistics of specified statistics type.
	 * 
	 * @param statsType statistics type
	 * 
	 * @return list of statistics of specified statistics type
	 */
	List<Statistics> selectStatisticsByType(StatsType statsType);
	
	// Common
	
	/**
	 * Returns list of all sites.
	 * 
	 * @return list of all sites
	 */
	List<Site> selectAllSites();
	
	/**
	 * Returns list of all objects.
	 * 
	 * @return list of all objects
	 */
	List<Object> selectAllObjects();
	
	/**
	 * Returns list of all attribute types.
	 * 
	 * @return list of all attribute types
	 */
	List<AttributeType> selectAllAttributeTypes();
	
	/**
	 * Returns list of all attributes.
	 * 
	 * @return list of all attributes
	 */
	List<Attribute> selectAllAttributes();
	
	/**
	 * Returns list of all statistics types.
	 * 
	 * @return list of all statistics types
	 */
	List<StatsType> selectAllStatsTypes();
	
	/**
	 * Returns list of all statistics.
	 * 
	 * @return list of all statistics
	 */
	List<Statistics> selectAllStatistics();

}
